﻿using Abp.Domain.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Abp.AutoMapper;

namespace MyCompanyName.AbpZeroTemplate.Prm.System
{
    public class LaboratoryAppService : AbpZeroTemplateAppServiceBase, ILaboratoryAppService
    {
        IRepository<Laboratory, int> laboratoryRepository;


        public LaboratoryAppService(IRepository<Laboratory, int> _laboratoryRepository)
        {
            laboratoryRepository = _laboratoryRepository;
        }

        public List<Dto.GetLaboratoryOutPut> GetAll()
        {
            var all = laboratoryRepository.GetAll();
            var model = all.MapTo<List<Dto.GetLaboratoryOutPut>>();
            return model;
        }


        public List<Dto.GetLaboratoryOutPut> GetAll(int rdCenterId)
        {
            var all = laboratoryRepository.GetAll().Where(x => x.RdCenterId == rdCenterId);
            var model = all.MapTo<List<Dto.GetLaboratoryOutPut>>();
            return model;
        }
    }
}
